package com.huak.heatmap.enums;

import lombok.Getter;

/**
 * @author liuhuan
 * @date 2018/10/26 17:40
 * @description
 */
@Getter
public enum  CityEnum {



    BEIJING("1","北京"),
    SHANGHAI("2","上海"),
    SHENZHEN("3","深圳"),
    GUANGZHOU("4","广州"),
    HANGZHOU("5","杭州"),
    CHENDU("6","成都");
    private String code;

    private String name;

     CityEnum(String code,String name){
        this.code=code;
        this.name=name;
    }

    /**
     *
     * @param code
     * @return
     */
    public static String getName(String code){
        CityEnum [] cityEnums=CityEnum.values();
        for(CityEnum cityEnum:cityEnums){
            if(cityEnum.getCode().equals(code)){
                return cityEnum.getName();
            }
        }
        return null;
    }

    public static void main(String[] args) {
        System.out.println(CityEnum.getName("1"));
    }
}
